int Max(int x, int y) {
    return x > y ? x : y;
}   
int** largestLocal(int** grid, int gridSize, int* gridColSize, int* returnSize)
{
    int** ans = malloc((gridSize - 2) * sizeof(int*));
    int i = 0;

    for (i = 0; i < gridSize - 2; i++) {
        ans[i] = malloc((gridSize - 2) * sizeof(int));
    }
    for (i = 0; i < gridSize - 2; i++) {
        int j = 0;
        for (j = 0; j < gridSize - 2; j++) {
            int x = 0;
            int y = 0;
            for (x = i; x <= i + 2; x++) {
                for (y = j; y <= j + 2; y++) {
                    ans[i][j] = Max(ans[i][j], grid[x][y]);
                }
            }
        }
    }
    *returnSize = gridSize - 2;
    *returnColumnSizes = malloc((gridSize - 2) * sizeof(int));
    for (i = 0; i < gridSize - 2; i++) {
        (*returnColumnSizes)[i] = gridSize - 2;
    }
    return ans;
   
}